Micron Document
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| SparkN0de-git | SparkN0de |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Commit 8688ef9fe1199b09ae4b06b588778e93a6ceea1b


Parents : 2cf6e5c
Author : Ivan <ivan@quad4.io>
Signature : Signature validation error
Date : 2026-04-13T17:34:08-05:00

feat(makefile): add development commands for Vite and Python backend, including help instructions and new script for local development

Changes

2 files changed, 52 insertions(+), 1 deletions(-)

M Makefile +24 -1

Diff

diff --git a/Makefile b/Makefile
index 569565eb..9c99b84e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,15 +1,38 @@
-.PHONY: install run build lint test test-be-perf clean
+.PHONY: install run dev dev-fe build lint test test-be-perf clean help dist-linux dist-linux-x64
install:
pnpm install
poetry install
+# Python backend only. For HMR, use: make dev OR make run in one terminal and pnpm run dev in another.
run:
poetry run python -m meshchatx.meshchat
+# Vite dev server (live reload) + backend. Open http://localhost:5173 — proxies /api and /ws to MESHCHAT_PORT (default 8000).
+dev:
+ bash scripts/dev-local.sh
+
+# Vite only; expects backend already running (e.g. make run on port 8000).
+dev-fe:
+ pnpm run dev -- --host 127.0.0.1 --port 5173
+
build:
pnpm run build
+# Linux AppImage + deb (see package.json dist:linux).
+dist-linux:
+ pnpm run dist:linux
+
+dist-linux-x64:
+ pnpm run dist:linux-x64
+
+help:
+ @echo "make dev - Vite HMR + backend (http://localhost:5173)"
+ @echo "make run - backend only"
+ @echo "make dev-fe - Vite only (pair with make run)"
+ @echo "make dist-linux - AppImage + deb (electron-builder)"
+ @echo "Env: MESHCHAT_PORT, E2E_BACKEND_PORT (vite proxy; script sets both), VITE_DEV_HOST, VITE_DEV_PORT"
+
lint:
pnpm run lint
poetry run ruff check .

diff --git a/scripts/dev-local.sh b/scripts/dev-local.sh
new file mode 100644
index 00000000..2b032228
--- /dev/null
+++ b/scripts/dev-local.sh
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+# Vite dev server (HMR) + MeshChat Python backend. Open http://localhost:5173 (or VITE_DEV_PORT).
+set -euo pipefail
+
+ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
+cd "$ROOT"
+
+export MESHCHAT_PORT="${MESHCHAT_PORT:-8000}"
+export E2E_BACKEND_PORT="$MESHCHAT_PORT"
+
+BE_PID=""
+cleanup() {
+ if [[ -n "$BE_PID" ]] && kill -0 "$BE_PID" 2>/dev/null; then
+ kill "$BE_PID" 2>/dev/null || true
+ wait "$BE_PID" 2>/dev/null || true
+ fi
+}
+trap cleanup EXIT INT TERM
+
+poetry run python -m meshchatx.meshchat &
+BE_PID=$!
+
+sleep "${DEV_BACKEND_WAIT:-1}"
+
+VITE_HOST="${VITE_DEV_HOST:-127.0.0.1}"
+VITE_PORT="${VITE_DEV_PORT:-5173}"
+
+pnpm run dev -- --host "$VITE_HOST" --port "$VITE_PORT"


──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────